package com.cn.xiaonuo.common.utils;

import java.util.HashMap;
import java.util.Map;

public class CommonUtils {

	public static int totalMoney(int chair_num,int room_num) {
		String chairType = "1";
		String roomType = "1";

		int total = 0;

		Map<String, Object> chair = new HashMap<>();
		chair.put("1", 20);
		chair.put("2", 30);
		chair.put("3", 50);
		chair.put("4", 70);

		Map<String, Object> room = new HashMap<>();
		room.put("1", 20);
		room.put("2", 30);
		room.put("3", 50);
		room.put("4", 70);

		if(chair_num <= 20){
			chairType = "1";
		}
		if (chair_num > 20 && room_num <= 50) {
			chairType = "2";
		}
		if (chair_num > 50 && room_num <= 200) {
			chairType = "3";
		}
		if (chair_num > 200) {
			chairType = "4";
		}

		// 微型
		if (room_num <= 10) {
			roomType = "1";
		}
		// 小型
		if (room_num > 10 && room_num <= 20) {
			roomType = "2";
		}
		// 中型
		if (room_num > 20 && room_num <= 50) {
			roomType = "3";
		}
		// room_num
		if (room_num > 50) {
			roomType = "4";
		}

		for (Map.Entry<String, Object> chairEntry : chair.entrySet()) {
			for (Map.Entry<String, Object> roomEntry : room.entrySet()) {
				String chairKey = chairEntry.getKey();
				String roomKey = roomEntry.getKey();
				if (chairType.equals(chairKey) && roomType.equals(roomKey)) {
					total = (int) chairEntry.getValue() + (int) roomEntry.getValue();
					break;
				}
			}
		}
		return total;
	}

}